package day04;
import java.util.Scanner;
public class DoWhileDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num1 = (int)(Math.random()*100+1);
        System.out.println(num1);//作弊
        System.out.println("请输入0~100之间的数, 猜数字");
        /*
        第一遍
        int guess1 = scan.nextInt();
        do {
            if(guess1>num1){
                System.out.println("猜大了");
            }else if (guess1<num1){
                System.out.println("猜小了");
            }
            guess1 = scan.nextInt();
        }while (guess1!=num1);
        System.out.println("恭喜您猜对了");
        第二遍
         int guess = scan.nextInt();
         do {
             if(guess>num1) {
                 System.out.println("猜大了");
             }else if(guess<num1) {
                 System.out.println("猜小了");
             }
             guess = scan.nextInt();
         }while (guess!=num1);
        System.out.println("恭喜您猜对了");
        */
        int guess = scan.nextInt();

        do {
            if (guess > num1){
                System.out.println("猜大了");
            }else if(guess<num1){
                System.out.println("猜小了");
            }
        }while (guess!=num1);
        System.out.println("恭喜你猜对了");
    }
}
